<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let url = 'http://www.shidazhi.cn/index.html?1x=1&name=zhufeng&teacher=aaa#box'
        function queryURLParams(url) {
            let result = {}
            let reg1 = /([^?=&#]+)=([^?=&#]+)/g
            let reg2 = /#([^?=&#]+)/g
            url.replace(reg1, (n, x, y) => result[x] = y)
            url.replace(reg2, (n, x) => result['HASH'] = x)
            return result
        }
        console.log(queryURLParams(url));
    </script>
</body>

</html>